﻿using MediatR;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using SmartApplication.Api.Applient.Command.Vendor;
using SmartApplication.Api.Dto;
using SmartApplication.ApiCode;

namespace SmartApplication.Api.Controllers
{
    /// <summary>
    /// 供应商控制器
    /// </summary>
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class VendorController : ControllerBase
    {
        public VendorController(IMediator mediator)
        {
            Mediator = mediator;
        }

        public IMediator Mediator { get; }


        /// <summary>
        /// 显示供应商信息
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        /// <exception cref="NotImplementedException"></exception>
        [HttpGet]
        public async Task<ApiResult<List<VendorDto>>> ListVendor([FromQuery]ListVendorCommand request)
        {
            return await Mediator.Send(request);
        }
    }
}
